#ifndef __SPI_H
#define __SPI_H

#include "util.h"

/**
  * @brief This function is the core function of the spi bus, and other functions are implemented by calling it.
  * @param RxLen :  number of bytes reading data
  * @param TxLen :  number of bytes writing data
  * @param RxBuff : pointer what  is stored from the spi bus
  * @param TxBuff : pointer what is read from spi bus 
  * @return null
  */
void YC_SpiControl (u16_t RxLen, u16_t TxLen, u8_t * RxBuff, u8_t * TxBuff) ;
/**
  * @brief Read flash 
  * @param FlashAddr : flash address where read data from
  * @param DataLen : number of bytes reading data 
  * @param pbuff : where the data is stored 
  * @return null
  */
void YC_FlashRead(u32_t FlashAddr, u16_t DataLen, u8_t * pbuff);
/**
  * @brief Write flash
  * @param FlashAddr : flash address where write data to
  * @param DataLen : number of bytes writing data
  * @param pbuff : the address where the sent data is stored
  * @return null
  */
void YC_FlashWrite(u32_t FlashAddr, u16_t DataLen, u8_t * pbuff);
/**
  * @brief Eraser flash
  * @param FlashAddr : flash address where cleared 
  * @return null
  */
void YC_FlashSectorErase(u32_t FlashAddr);

#endif
